﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProductDetails.aspx.cs" Inherits="Shop.Web.ProductDetails" %>

<asp:Content ID="contentMain" runat="server" ContentPlaceHolderID="mainContent" >
<script type="text/javascript">
<%--$(document).ready(
	            function() {
	                GetSubCategoriesList(0, 'ddlCatFirst', false);
	                GetSubCategoriesList(23, '<%=ddlCatSecond.ClientID %>', false);
	            });--%>
function GetSubCategoriesList(id, controlId, load)
{
    $('#'+controlId).html("&nbsp;");
	url = 'AjaxHtmlContent.aspx?Content=CategorySelect&id='+id;
	$('#'+controlId).load(url);
	if (load && $('#'+controlId).val() != null)
	{
	    if (controlId == 'ddlCatFirst')
        {
	        GetSubCategoriesList($('#'+controlId).val(), 'ddlCatFirst');
        }
       <%-- else if (controlId == 'ddlCatSecond')
	    {
	        GetSubCategoriesList($('#'+controlId).val(), '<%=ddlCatThird.ClientID %>');
        }--%>
	}
	
}

function SetCategory()
{
 <%--$('#<%= hdnCategory.ClientID %>').val($('#<%=ddlCatSecond.ClientID %>').val());--%>
 return true;
}

</script>
<asp:HyperLink runat="server" id="hlHeader"></asp:HyperLink>
<div id="tabs">
    <ul>
        <li><a href="#group"><span>Группа</span></a></li>
        <li><a href="#photo"><span>Фото</span></a></li>
        <li><a href="#product"><span>Продукты</span></a></li>
    </ul>
    <div id="group">
        <table>
    <tr>
    <td>Название:</td>
    <td><common:TextBox runat="server" ID="tbName"></common:TextBox></td>
    <td></td>
</tr>
<tr>
    <td valign="top">Описание:</td>
    <td><common:TextBox runat="server" ID="tbDescription" TextMode="MultiLine" SkinID="MultiLine"></common:TextBox>
    <td></td>
</td>
</tr>
<tr>
    <td>Производитель:</td>
    <td><common:DropDownList runat="server" ID="ddlBrand"></common:DropDownList></td>
    <td></td>
</tr>

<tr>
    <td>Категория:</td>
    <td>
        <asp:PlaceHolder runat="server" id="phCategory">
            <common:DropDownList runat="server" ID="ddlCat"></common:DropDownList>
        </asp:PlaceHolder>
        <asp:Label runat="server" id="lblCategory" visible="false"></asp:Label>
    </td>
    <td></td>
</tr>
<tr>
    <td>Статус:</td>
    <td><common:DropDownList runat="server" ID="ddlStatus"></common:DropDownList></td>
    <td></td>
</tr>
<tr>
    <td>Показывать</td>
    <td><asp:CheckBox  runat="server" id="chbVisible"></asp:CheckBox></td>
    <td></td>
</tr>
<tr>
    <td valign="top">Фото:</td>
    <td>
        <img runat="server" id="imgProduct"/><br />
        <asp:FileUpload runat="server" id="fuImage"></asp:FileUpload>    
    </td>
    <td></td>
</tr>

<tr>
    <td valign="top">Артикулы</td>
    <td>
    <asp:Repeater id="rprBrandArt" runat="server" >
        <ItemTemplate>
            <asp:CheckBox runat="server" id="chbUnMerge" Text='<%# DataBinder.Eval(Container.DataItem, "Key")%>'></asp:CheckBox><br />
        </ItemTemplate>
    </asp:Repeater>
    <asp:Button runat="Server" id="btnUnMerge" OnClick="btnUnMerge_Click" Visible="false" Text="Перенести в новую группу"/>
    </td>
    <td> </td>
</tr>

</table>
</div>
<div id="photo">
<table>
<tr>
    <td valign="top">Фото:</td>
    <td>
        <img runat="server" id="img1"/><br />
        <asp:FileUpload runat="server" id="fuImage1"></asp:FileUpload>    
    </td>
    <td></td>
</tr>

<tr>
    <td valign="top">Фото:</td>
    <td>
        <img runat="server" id="img2"/><br />
        <asp:FileUpload runat="server" id="fuImage2"></asp:FileUpload>    
    </td>
    <td></td>
</tr>
<tr>
    <td valign="top">Фото:</td>
    <td>
        <img runat="server" id="img3"/><br />
        <asp:FileUpload runat="server" id="fuImage3"></asp:FileUpload>    
    </td>
    <td></td>
</tr>
<tr>
    <td valign="top">Фото:</td>
    <td>
        <img runat="server" id="img4"/><br />
        <asp:FileUpload runat="server" id="fuImage4"></asp:FileUpload>    
    </td>
    <td></td>
</tr>
</table>
</div>
<div id="product">
<table width="100%">
<tr>
    <th>Артикул</th>
    <th>Название</th>
    <th>Количество</th>
    <th>Цена</th>
    <th>Опт</th>
</tr>
 <asp:Repeater id="rprProduct" runat="server" >
        <ItemTemplate>
            <tr>
                <td>
                    <%# DataBinder.Eval(Container.DataItem, "BrandArt")%>
                    <asp:HiddenField runat="server" id="hdnProductId" Value='<%# DataBinder.Eval(Container.DataItem, "Id")%>'></asp:HiddenField>
                </td>
                <td>
                    <%# DataBinder.Eval(Container.DataItem, "Name")%>
                </td>
                <td class="right">
                    <asp:CheckBox runat="server" id="chbVisible" Checked='<%# DataBinder.Eval(Container.DataItem, "Visible")%>' />
                    <asp:TextBox runat="server" id="tbQty" Text='<%# DataBinder.Eval(Container.DataItem, "Qty")%>' SkinID="Qty"/>
                </td>
                <td  class="right">
                    <asp:TextBox runat="server" id="tbPrice" Text='<%# DataBinder.Eval(Container.DataItem, "Price", "{0:f}")%>' />
                </td>
                <td class="right">
                    <asp:TextBox runat="server" id="tbWhlPrice" Text='<%# DataBinder.Eval(Container.DataItem, "PriceItem.WholesellPrice", "{0:f}")%>' />
                </td>
            </tr>
        </ItemTemplate>
    </asp:Repeater>
    </table>
 <asp:Button runat="server" id="btnUpdateProductList" OnClick="btnUpdateProductList_Click" Text="Сохранить изменения по списку продуктов"/>
</div>
</div>
<asp:Button runat="server" id="btnSave" Text="Сохранить" Visible="false" OnClick="btnSave_Click" OnClientClick="SetCategory();"/>&nbsp;
<asp:Button runat="server" id="btnCancel" Text="Отменить" Visible="false" OnClick="btnCancel_Click"/>&nbsp;
<asp:Button runat="server" id="btnEdit" Text="Редактировать" Visible="false" OnClick="btnEdit_Click"/>&nbsp;
<asp:Button runat="server" id="btnDelete" Text="Удалить" Visible="false" OnCLick="btnDelete_Click"/>

</asp:Content>
